package call4paper;

import java.util.Vector;

import website.User;

public class PaperJob {
	private String title, summary;
	private String revisorsComment;
	private User author;
	private Vector<InterestArea> aplicationArea = new Vector<InterestArea>();
	private Vector<Qualification> qualifications = new Vector<Qualification>();
	private String status = "not revised";
	private String notePaper = "not qualification";
	private Vector<User> reviewers = new Vector<User>();
	
	
	public PaperJob() {}
	
	public PaperJob(User author, String title, String summary, Vector<InterestArea> aplicationArea){
		this.author = author;
		this.title = title;
		this.summary = summary;
		this.aplicationArea.addAll(aplicationArea);
	}
	
	public void qualify(User user, Qualification quali, String comment) {
		this.qualifications.add(quali);
		this.revisorsComment = this.revisorsComment+user.getUsername()+": "+comment+"/n";
		user.getToBeRevized().remove(this);
	}
	
	public void setStatus(String status){
		this.status = status;
	}
	
	/**
	 *Evalua para saber si es aceptado o rechazado 
	 */
	public void toEvaluate(){
		int i = 0;
		for(Qualification q: this.qualifications){
			if(q == Qualification.Rejected || q == Qualification.AcceptedWithModifications)
				i++;
		}
		if(i < 2)
			this.notePaper =  "Accepted";
		else
			this.notePaper = "Reject";
	}
	
	//GETTER AND SETTER
	
	public Vector<Qualification> getQualification(){
		return qualifications;
	}
	
	public void setQualification(Qualification quali){
		qualifications.add(quali);
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	public User getAuthor() {
		return author;
	}
	public void setAuthor(User author) {
		this.author = author;
	}
	public Vector<InterestArea> getAplicationArea() {
		return aplicationArea;
	}
	public void setAplicationArea(Vector<InterestArea> aplicationArea) {
		this.aplicationArea = aplicationArea;
	}

	public boolean contains(Qualification quali) {
		return qualifications.contains(quali);
	}

	public Vector<User> getReviewer(){
		return reviewers;
	}

	public void setNotePaper(String notePaper) {
		this.notePaper = notePaper;
	}

	public String getNotePaper() {
		return notePaper;
	}

}	